package com.it.server.mapper;
import com.it.pojo.Entity.Users;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.Map;

@Mapper
@Repository
public interface UserMapper {

    /**
     * 根据openid查询用户
     * @param openid
     * @return
     */
    @Select("select * from users where openid = #{openid}")
    Users getByOpenid(String openid);

    /**
     * 插入数据
     * @param user
     */
    void insert(Users user);

    @Select("select * from users where id = #{id}")
    Users getById(Long userId);

    /**
     * 根据动态条件统计用户数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
